﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            ArrayList s1 = new ArrayList();
            while (true)
            {
                ArrayList al = new ArrayList();

                try
                {
                    Console.WriteLine("输入成绩：");
                    double d = double.Parse(Console.ReadLine());
                    Console.WriteLine("你输入的成绩是：" + d);
                }
                catch (FormatException)
                {
                    Console.WriteLine("异常已处理");
                }
                catch (OverflowException)
                {
                    Console.WriteLine("异常已处理");
                }
                catch (Exception)
                {
                    Console.WriteLine("捕获一般异常");
                }
                finally
                {
                    Console.WriteLine("异常已处理");
                }

                for (int i = 0; i < 3; i++)
                {
                    Console.WriteLine("请输入成绩：");
                    double d = double.Parse(Console.ReadLine());
                    Console.WriteLine("你输入的成绩是：" + d);
                    s1.Add(d);
                }


                Console.WriteLine("学生总数");
                double sum = 0;
                for (int i = 0; i < s1.Count; i++)
                {
                    sum = sum + (double)s1[1];
                }
                Console.WriteLine("总分数为" + sum);
                double avg = sum / s1.Count;
                Console.WriteLine("平均分为" + avg);
                Console.ReadKey();
            }
        } 
    }
}
